<? 
include("protect1.php"); 
?>
<STYLE type=text/css>.blank {
	FONT-SIZE: 0px; WIDTH: 0px; HEIGHT: 0px
}
TD {
	FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
INPUT {
	FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
.present {
	FONT-WEIGHT: bold; BACKGROUND-COLOR: #dee5ec
}
.h1 {
	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #ffffff
}
.d1 {
	COLOR: #c0c0c0
}
.link {
	FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: #ffffff; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.footer {
	FONT-WEIGHT: normal; FONT-SIZE: 10px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.footer1 {
	FONT-WEIGHT: bold; FONT-SIZE: 10px; BACKGROUND-IMAGE: url(chat/images/menu_b.gif); CURSOR: default; COLOR: #000000; BORDER-BOTTOM: 0px
}
.header {
	FONT-WEIGHT: bold; FONT-SIZE: 10px; BACKGROUND-IMAGE: url(chat/images/menu_h.gif); CURSOR: default; COLOR: #000000; BORDER-BOTTOM: 0px
}
.textcol {
	FONT-SIZE: 12px; COLOR: #2378d5; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
</STYLE>

<?php
    	$nrp=$reg_uname;
	include("banner.html");
	include("connect.php");
	$pilih=mysql_select_db("uwika_skk",$conn);
	echo "<BR>";

	$sqlstr="select date_format(kegiatan.tanggal,'%d-%m-%Y'), kegiatan.nama,score.poin,score.keterangan from kegiatan,score where score.nrp='$nrp' and score.kode=kegiatan.kode and kegiatan.jenis='1'";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	echo "<b>I. Kegiatan Ilmiah / Penalaran</b><br>";
	echo "<table width=\"75%\" border=\"1\">";
	echo "<tr><td><Center>Tanggal</td><td><center>Nama Kegiatan</td><td><center>Perolehan Poin</td><td><center>Keterangan</td></tr>";
	$totalpoin=0;
	do {
		list($tanggal,$nama,$poin,$keterangan) = $row;
		echo "<tr><td><center>$tanggal</td>";		
		echo "<td>$nama</td>";
		echo "<td><center>$poin</td>";
		$totalpoin=$totalpoin + $poin;
		echo "<td>$keterangan</td></tr>";
	} while ($row=mysql_fetch_row($hasil));
	echo "</table>";
	echo "Perolehan poin anda sampai detik ini : <font size=5><b>$totalpoin";
	$jurusan=substr($nrp,0,3);
	switch ($jurusan) {
		case '611' : 
			{
				if ($totalpoin < 500) {
					echo " / 500 </b></font> poin.  <blink><font color=\"#FF0000\"><b>BELUM MEMENUHI</b></font></blink>";		
				} else {
					echo " / 500 </b></font> poin.  <blink><font color=\"#008000\"><b>SUDAH MEMENUHI</b></font></blink>";	
				}
				break;
			}
		default :
			{
				if ($totalpoin < 700) {
					echo " / 700 </b></font> poin.  <blink><font color=\"#FF0000\"><b>BELUM MEMENUHI</b></font></blink>";		
				} else {
					echo " / 700 </b></font> poin.  <blink><font color=\"#008000\"><b>SUDAH MEMENUHI</b></font></blink>";	
				}
				break;
			}
				
	}
	echo "<br><br>";

	
	$sqlstr="select date_format(kegiatan.tanggal,'%d-%m-%Y'), kegiatan.nama,score.poin,score.keterangan from kegiatan,score where score.nrp='$nrp' and score.kode=kegiatan.kode and kegiatan.jenis='2'";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	echo "<b>II. Minat Bakat</b><br>";
	echo "<table width=\"75%\" border=\"1\">";
	echo "<tr><td><Center>Tanggal</td><td><center>Nama Kegiatan</td><td><center>Perolehan Poin</td><td><center>Keterangan</td></tr>";
	$totalpoin=0;
	do {
		list($tanggal,$nama,$poin,$keterangan) = $row;
		echo "<tr><td><center>$tanggal</td>";		
		echo "<td>$nama</td>";
		echo "<td><center>$poin</td>";
		$totalpoin=$totalpoin + $poin;
		echo "<td>$keterangan</td></tr>";
	} while ($row=mysql_fetch_row($hasil));
	echo "</table>";
	echo "Perolehan poin anda sampai detik ini : <font size=5><b>$totalpoin";
	$jurusan=substr($nrp,0,3);
	switch ($jurusan) {
		case '611' : 
			{
				if ($totalpoin < 300) {
					echo " / 300 </b></font> poin.  <blink><font color=\"#FF0000\"><b>BELUM MEMENUHI</b></font></blink>";		
				} else {
					echo " / 300 </b></font> poin.  <blink><font color=\"#008000\"><b>SUDAH MEMENUHI</b></font></blink>";	
				}
				break;
			}
		default :
			{
				if ($totalpoin < 420) {
					echo " / 420 </b></font> poin.  <blink><font color=\"#FF0000\"><b>BELUM MEMENUHI</b></font></blink>";		
				} else {
					echo " / 420 </b></font> poin.  <blink><font color=\"#008000\"><b>SUDAH MEMENUHI</b></font></blink>";	
				}
				break;
			}
				
	}
	echo "<br><br>";

	$sqlstr="select date_format(kegiatan.tanggal,'%d-%m-%Y'), kegiatan.nama,score.poin,score.keterangan from kegiatan,score where score.nrp='$nrp' and score.kode=kegiatan.kode and kegiatan.jenis='3'";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	echo "<b>III. Lain - Lain</b><br>";
	echo "<table width=\"75%\" border=\"1\">";
	echo "<tr><td><Center>Tanggal</td><td><center>Nama Kegiatan</td><td><center>Perolehan Poin</td><td><center>Keterangan</td></tr>";
	$totalpoin=0;
	do {
		list($tanggal,$nama,$poin,$keterangan) = $row;
		echo "<tr><td><center>$tanggal</td>";		
		echo "<td>$nama</td>";
		echo "<td><center>$poin</td>";
		$totalpoin=$totalpoin + $poin;
		echo "<td>$keterangan</td></tr>";
	} while ($row=mysql_fetch_row($hasil));
	echo "</table>";
	echo "Perolehan poin anda sampai detik ini : <font size=5><b>$totalpoin";
	$jurusan=substr($nrp,0,3);
	switch ($jurusan) {
		case '611' : 
			{
				if ($totalpoin < 200) {
					echo " / 200 </b></font> poin .  <blink><font color=\"#FF0000\"><b>BELUM MEMENUHI</b></font></blink>";		
				} else {
					echo " / 200 </b></font> poin.  <blink><font color=\"#008000\"><b>SUDAH MEMENUHI</b></font></blink>";	
				}
				break;
			}
		default :
			{
				if ($totalpoin < 280) {
					echo " / 280 </b></font> poin .  <blink><font color=\"#FF0000\"><b>BELUM MEMENUHI</b></font></blink>";		
				} else {
					echo " / 280 </b></font> poin.  <blink><font color=\"#008000\"><b>SUDAH MEMENUHI</b></font></blink>";	
				}
				break;
			}
				
	}
	echo "<br><br>";

	function tampil($periode,$nrp,$smt) {
		global $smt,$allsks,$allnilai;
		$sqlstr="select kodemk,nama,sks,nilai from sks where nrp='$nrp' and periode='$periode'";
		$hasil=mysql_query($sqlstr);
		list($kodemk) = mysql_fetch_row($hasil);
		if (!empty($kodemk)) {
			$smt=$smt + 1;
			$totsks=0;
			$totbobot=0;
			$sqlstr="select kodemk,nama,sks,nilai from sks where nrp='$nrp' and periode='$periode'";
			$hasil=mysql_query($sqlstr);
			echo "SEMESTER : <b>$smt</b> <br>";
			echo "PERIODE : <b>$periode</b>";
			echo "<tr><td width=5%></td><td>";
			echo "<table width=\"70%\" border=\"1\">";
			echo "<tr>";
			echo "<td width=\"5%\"><b><center>K O D E</center></td>";
			echo "<td width=\"20%\"><B><center>N A M A &nbsp; M A T A  &nbsp; K U L I A H</center></td>";
			echo "<td width=\"5%\"><B><center>SKS</center></td>";
			echo "<td width=\"3%\"><b><center>GRADE</center></td>";
			echo "</tr>";
			$row = mysql_fetch_row($hasil);
			do {
				list($kodemk,$nama,$sks,$nilai) = $row;
				echo "<tr><td><center>$kodemk</center></td>";
				echo "<td>$nama</td>";
				echo "<td><center>$sks</center></td>";
				$totsks=$totsks + $sks;
				$totbobot=$totbobot + (huruf2angka($nilai) * $sks);
				switch ($nilai) {
					case "A" : {
						$allnilai = $allnilai + (4 * $sks) ;
						break;
					}
					case "B" : {
						$allnilai = $allnilai + (3 * $sks);
						break;
					}
					case "C" : {
						$allnilai = $allnilai + (2 * $sks);
						break;
					}
					case "D" : {
						$allnilai = $allnilai + (1 * $sks);
						break;
					}
					case "E" : {
						$allnilai = $allnilai + 0;
						break;
					}
				}
				echo "<td><center>$nilai</center></td></tr>";
			} while ($row=mysql_fetch_row($hasil));
			echo "</table>";
			echo "Total SKS : <b>$totsks</b> &nbsp&nbsp | &nbsp&nbsp ";
			$allsks=$allsks+$totsks;
			echo "Nilai IPS : <b> ";
			echo round($totbobot / $totsks,3);
			echo "</b><br><br>";
		}
	}

	function huruf2angka($nilai) {
		switch ($nilai) {
			case "A" :
				return 4;
				break;
			case "B" :
				return 3;
				break;
			case "C" :
				return 2;
				break;
			case "D" :
				return 1;
				break;
			case "E" :
				return 0;
				break;
		}
	}
	echo "<br>";
	include("footer.php");
?>